<?php
/**
 * Created by PhpStorm.
 * User: 64423
 * Date: 2018/10/31
 * Time: 10:58
 */

namespace app\shop\home;
use app\shop\model\ArticleModel;


class Article
{
    public function getArticleList()
    {
        $page = input('get.page',1);
        $row = input('get.row',20);
        $cate = input('get.cate',0);
        $sort_type = input('get.sort_type','default');    //time click_num comment_num
        if($cate == 0){
            $where = '1=1';
        }else{
            $where = [
                'cate_id'=>$cate
            ];
        }
        $order = '';
        if($sort_type != 'default'){
            $order .= $sort_type.' desc,';
        }
        $order .= 'sort desc';
        $art_list = ArticleModel::getRes($page,$row,$where,$order);
        return _json('2000', $art_list,'success');
    }

}